// components/navbar/index.js
const App = getApp();

Component({
  options: {
    addGlobalClass: true,
  },
  /**
   * 组件的属性列表
   */
  properties: {
    imgHidden: {
      type: Boolean,
      value: true
    },
    pageName: String,
    showNav: {
      type: Boolean,
      value: true
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    back_hide: true,
  },
  lifetimes: {
    attached: function () {
      this.setData({
        navHeight: App.globalData.navHeight,
        navTop: App.globalData.navTop
      })
      // console.log(getCurrentPages())
      if (getCurrentPages().length > 1) {
        this.setData({
          back_hide: false
        })
      } else {
        this.setData({
          back_hide: true
        })
      }
      // console.log(this.data.imgHidden)
    }

  },
  /**
   * 组件的方法列表
   */
  methods: {
    //回退
    navBack: function () {
      wx.navigateBack({
        delta: 1
      })
    },
    // //回主页
    // toIndex: function () {
    //   wx.navigateTo({
    //     url: '/pages/admin/home/index/index'
    //   })
    // },
  }
})